package com.wdb.utils;

import java.io.Closeable;
import java.io.IOException;

/**
 * @author: wendaobai@qq.com
 * @date: 2024/9/9 星期一 17:07
 */
public class CloseUtil {
  public static void close(Closeable closeable) {
    if (closeable != null) {
      try {
        closeable.close();
      } catch (IOException e) {
        throw new RuntimeException(e);
      }
    }
  }

  public static void close(AutoCloseable closeable) {
    if (closeable != null) {
      try {
        closeable.close();
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
  }
}
